/* This program for a 16x2 LCD display is based on a HD44780 display controller. The Analog Voltage is displayed on line #1, and the Raw Input on line #2. WA7RSO 08/22/2013 */ #include // alert compiler to include the lcd library int RS = 8; // Register Select on pin #4 of the LCD int RW = 9; // Read/Write on pin #5 of the LCD int E = 10; // Enable on pin #6 of the LCD //defines the pins used from the LCD to the Arduino (New Interface Board) LiquidCrystal lcd(RS, E, 4, 5, 6, 7); int rawNumber; String InputVoltage; void setup() //required function { // initialize serial communication at 9600 bits per second: // Serial.begin(9600); //see text pinMode(RW, OUTPUT); digitalWrite(RW, LOW); // Allow "Writing" to the LCD lcd.begin(16,2); //let the program know the size of the display to be handled } void loop() // Dummy Loop { // Read the analog input on pin #0 int sensorValue = analogRead(A0); // Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V): float voltage = sensorValue * (5.0 / 1023.0); // print out the value you read: // Serial.println(voltage); lcd.setCursor(0,0); // InputVoltage = Stringvoltage; lcd.print("Voltage: "); lcd.print(voltage); lcd.print("V"); Clear2ndLine(); lcd.setCursor(0,3); rawNumber = sensorValue; lcd.print("Raw Value: "); lcd.print(String(sensorValue)); delay(250); // Minimize some of the flutter } void Clear2ndLine() { lcd.setCursor(0,1); lcd.print(" "); }